package com.renjie.day01.homework;

public class Arm {
    String armNo;
    String armName;
    //引用类型的数组
    Soldier[] soldiers = new Soldier[10];

    public Arm(String armNo, String armName) {
        this.armNo = armNo;
        this.armName = armName;
        /*soldiers = new Soldier[10];*/
    }

    public void addSoldier(Soldier s, int i) {
        if (i < soldiers.length) {
            soldiers[i] = s;
        }
    }

    public void listSoldier() {
        String job = "";
        String name = "";
        for (int i = 0; i < soldiers.length; i++) {
            job = soldiers[i].soldierJob;
            name = soldiers[i].soldierName;
            System.out.println("军人的职务是：" + job + " " + "军人的名字是：" + name);
            soldiers[i].UseSkill();
        }
    }
}
